import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QuestionaireQuestionVO, QuestionaireQuestionForm, QuestionaireQuestionQuery } from '@/api/stroke/questionaireQuestion/types';

/**
 * 查询问卷题目列表
 * @param query
 * @returns {*}
 */

export const listQuestionaireQuestion = (query?: QuestionaireQuestionQuery): AxiosPromise<QuestionaireQuestionVO[]> => {
  return request({
    url: '/stroke/questionaireQuestion/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询问卷题目详细
 * @param id
 */
export const getQuestionaireQuestion = (id: string | number): AxiosPromise<QuestionaireQuestionVO> => {
  return request({
    url: '/stroke/questionaireQuestion/' + id,
    method: 'get'
  });
};

/**
 * 新增问卷题目
 * @param data
 */
export const addQuestionaireQuestion = (data: QuestionaireQuestionForm) => {
  return request({
    url: '/stroke/questionaireQuestion',
    method: 'post',
    data: data
  });
};

/**
 * 修改问卷题目
 * @param data
 */
export const updateQuestionaireQuestion = (data: QuestionaireQuestionForm) => {
  return request({
    url: '/stroke/questionaireQuestion',
    method: 'put',
    data: data
  });
};

/**
 * 删除问卷题目
 * @param id
 */
export const delQuestionaireQuestion = (id: string | number | Array<string | number>) => {
  return request({
    url: '/stroke/questionaireQuestion/' + id,
    method: 'delete'
  });
};
